const Controller = require('egg').Controller;

class MenuController extends Controller {
  // 根据用户的Id来获取菜单列表
  async index() {
    try {
      let role = this.ctx.request.query;
      console.log(role.roleId);
      let menuList = await this.ctx.service.menu.getMenu(role.roleId);
      this.ctx.body = {
        code: 20000,
        message: '获取菜单成功',
        data: menuList
      };
    } catch (err) {
      this.ctx.body = {
        code: 50000,
        message: '获取异常'
      };
    }
  }
}

module.exports = MenuController;

